function applyCommon() {
    insertBackBtn();
    let elements = document.querySelectorAll('base');
    if (elements.length === 0 || !elements) {
        elements = [document.createElement("base")];
        document.body.appendChild(elements[0]);
    }
    for (let i = 0; i < elements.length; i++) {
        const base = elements[i];
        base.href = location.href;
    }
    // <meta property="og:url" content="https://time.geekbang.org/column/intro/100090001" style="user-select: text;">
    // 获取meta标签
    let metas = document.querySelectorAll('meta');
    for (let i = 0; i < metas.length; i++) {
        const ogUrl = metas[i];
        // 判定og:url
        const property = ogUrl.getAttribute('property');
        if (property !== 'og:url') {
            continue;
        }
        ogUrl.setAttribute('content', location.href);
    }
    // <link rel="canonical" href="https://time.geekbang.org/column/intro/100090001" style="user-select: text;">
    let links = document.querySelectorAll('link[rel="canonical"]');
    for (let i = 0; i < links.length; i++) {
        links[i].href = location.href;
    }
}

function insertBackBtn() {
    const backBtn = document.createElement('div');
    backBtn.className = 'back-btn';
    const backBtnText = document.createElement('div');
    backBtnText.innerText = '目录';
    const backBtnIcon = document.createElement('div');
    backBtnIcon.innerHTML = '<span class="glyphicon glyphicon-share-alt" style="color: darkgrey;transform:rotate(180deg);"></span>';
    backBtn.appendChild(backBtnText);
    backBtn.appendChild(backBtnIcon);
    document.body.appendChild(backBtn);
    backBtn.onclick = () => {
        window.location.href = window.location.protocol + "//" + window.location.host;
    }

    let backHideTimeout = null;

    // 当鼠标放置在目录按钮上三秒则消失 start
    backBtn.addEventListener('mouseenter', ()=>{ backHideTimeout = setTimeout(()=>{ backBtnDom.style.display = "none";
        backHideTimeout = null;
    },3000);
    });

    backBtn.addEventListener('mouseleave', ()=>{
        if (backHideTimeout != null) {
            clearTimeout(backHideTimeout);
            backHideTimeout = null;
        }
    });
}